package com.yyy.tcc.service;

import com.yyy.tcc.entity.Account;
import java.math.BigDecimal;

/**
 * 账户服务接口
 */
public interface AccountService {
    /**
     * Try阶段：尝试冻结转出账户金额
     */
    boolean tryStage(String transactionId, String fromUserId, String toUserId, BigDecimal amount);

    /**
     * Try阶段：尝试冻结转出账户金额，带超时
     */
    boolean tryStageWithTimeout(String transactionId, String fromUserId, String toUserId, BigDecimal amount, int timeoutSeconds);

    /**
     * Confirm阶段：确认转账
     */
    boolean confirm(String transactionId);

    /**
     * Cancel阶段：取消转账，解冻金额
     */
    boolean cancel(String transactionId);

    /**
     * 获取账户信息
     */
    Account getAccount(String userId);

    /**
     * 获取账户余额
     */
    BigDecimal getAccountBalance(String userId);

    /**
     * 获取交易状态
     */
    String getTransactionStatus(String transactionId);
}
